package com.weblog.model.article;

import javax.persistence.*;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

/**
 * tag实体类
 * @author Administrator
 *
 */
@Entity
@Table(name="tb_tag")
public class Tag implements Serializable{

	private static final long serialVersionUID=-4678126655562943999L;

	@Id
	private String id;//标签id
	private String tagname;//标签名称
	private String state;//状态 0弃用 1使用state
	private int times;//使用次数

	@ManyToMany(mappedBy = "tags",fetch = FetchType.EAGER)
	private Set<Article> articles=new HashSet<>();

	@Override
	public String toString() {
		return "Tag{" +
				"id='" + id + '\'' +
				", tagname='" + tagname + '\'' +
				", state='" + state + '\'' +
				", times=" + times +
				'}';
	}

	public int getTimes() {
		return times;
	}

	public void setTimes(int times) {
		this.times = times;
	}

	public Set<Article> getArticles() {
		return articles;
	}

	public void setArticles(Set<Article> articles) {
		this.articles = articles;
	}

	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}

	public String getTagname() {
		return tagname;
	}
	public void setTagname(String tagname) {
		this.tagname = tagname;
	}

	public String getState() {
		return state;
	}
	public void setState(String state) {
		this.state = state;
	}


	
}
